Skip to content

Conversation

@dereuromark
Copy link
Member

Prepare #716

@dereuromark dereuromark closed this Nov 6, 2025
@dereuromark dereuromark reopened this Nov 6, 2025
@dereuromark
Copy link
Member Author

For some reason 4.x is now protected already, even though just created.
I have the ready branch at "4.x-squashed", maybe someone with access can just force push into 4.x?

@dereuromark dereuromark requested a review from ADmad November 6, 2025 06:04
@ADmad
Copy link
Member

ADmad commented Nov 6, 2025

For some reason 4.x is now protected already, even though just created.

The protection rule is set for *.x, that's way. I have temporarily changed it to 3.x, so you should be able to force push to 4.x now.

@dereuromark dereuromark marked this pull request as ready for review November 6, 2025 14:27
@dereuromark
Copy link
Member Author

Auth code looks pretty clean and cake-user-friendly now, doesnt it?

@dereuromark dereuromark changed the title Remove deprecations, fix up MultiChecker. 4.x major: Remove deprecations, fix up MultiChecker. Nov 7, 2025
@dereuromark dereuromark added this to the 4.x milestone Nov 20, 2025
@dereuromark
Copy link
Member Author

@ADmad How do we merge our regression fix into this?
Do we want to keep the "cleaner" constructor of 4.x? Or do we move to the lazy defaulting?

@ADmad
Copy link
Member

ADmad commented Nov 29, 2025

Doing it in getIdentifier() does have the benefit that the objects chain gets initialized only when needed.

- Use lazy identifier initialization in getIdentifier() (3.x approach)
- Add AuthenticationPlugin as main plugin class, Plugin as deprecated alias
- Add redirect validation feature from 3.x
- Update all authenticators to use getIdentifier() instead of direct property access
Copy link
Member

@markstory markstory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. I think the impacts of these breaking changes should be a reasonable amount of work in a small section for most applications. I don't think we need to worry about rector here. I like how the authenticator + identifier relationship has ended up working.

@dereuromark
Copy link
Member Author

Just to be clear:

Config needs to change from:

  $identifier = [
      'Authentication.Token' => [
          'tokenField' => 'id',
          'dataField' => 'key',
          'resolver' => [
              'className' => 'Authentication.Orm',
              'finder' => 'auth',
          ],
      ],
  ];

To:

  $identifier = [
      'className' => 'Authentication.Token',
      'tokenField' => 'id',
      'dataField' => 'key',
      'resolver' => [
          'className' => 'Authentication.Orm',
          'finder' => 'auth',
      ],
  ];

We could shim this (allow for the old array one), but then it would be possible to also insert multiple array key/value pairs or alike.

@ADmad
Copy link
Member

ADmad commented Dec 12, 2025

I think just clarifying the change in a migration guide should suffice

dereuromark added a commit to cakephp/upgrade that referenced this pull request Dec 13, 2025
Adds rules to automate the 3.x to 4.x migration for the authentication plugin:

- Rename CakeRouterUrlChecker to DefaultUrlChecker
- Rename DefaultUrlChecker (framework-agnostic) to GenericUrlChecker
- Rename Plugin to AuthenticationPlugin
- Remove loadIdentifier() method calls

See: cakephp/authentication#748
@dereuromark dereuromark marked this pull request as draft January 13, 2026 15:37
@dereuromark
Copy link
Member Author

This PR is only for review, we dont merge this one, correct? As we directly release on 4.x branch

@LordSimal
Copy link
Contributor

Correct, 4.x will stay as it is and the new release will be done on that branch

josbeir and others added 20 commits January 13, 2026 17:25
PrimaryKeySessionAuthenticator now works out of the box without
requiring explicit identifier configuration. When no identifier is
provided, it lazily creates a TokenIdentifier configured to look up
users by their `id` field.

Before:
```php
$service->loadAuthenticator('Authentication.PrimaryKeySession', [
    'identifier' => [
        'className' => 'Authentication.Token',
        'tokenField' => 'id',
        'dataField' => 'key',
    ],
]);
```

After:
```php
$service->loadAuthenticator('Authentication.PrimaryKeySession');
```

Custom configuration is still supported by passing an explicit
identifier or by using the `idField` and `identifierKey` config
options which propagate to the default TokenIdentifier.
…ult-identifier

Add default TokenIdentifier for PrimaryKeySessionAuthenticator
Add test coverage for getIdentity() with no identity present
Allow using dot separated field names for Identity::get()
Add IdentityHelper::getIdentity()
The identify option was deprecated in 3.x in favor of
PrimaryKeySessionAuthenticator. Remove it for the 4.x major.
Remove fields config and constructor from SessionAuthenticator
since they were only used by the removed identify logic.
Remove redundant constructor override from
PrimaryKeySessionAuthenticator. Simplify tests.
Default to null so authenticators that don't need an identifier
(like SessionAuthenticator) can be constructed without arguments.
@dereuromark
Copy link
Member Author

@ADmad merged 3.x and did the cleanup.
If there is nothing else left feel free to release/tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants